#include "ModeloEstructurado.cpp"
#include "Blocksort.cpp"
#include "MTF.cpp"
#include "includes.h"

int main (int argc, char* argv[]) {

	if (argc != 3) {
		cout << "Uso incorrecto." << endl;
	}
	else {
		char* modoEjecucion = argv[1];
		char* filename = argv[2];
		
		uInt blocksize = 900 * 1024;
		
		if (*modoEjecucion == 'c') {
		
			BlocksortCompress bs( filename , blocksize);
			bs.setOutputFilename( "blocksortcompress.dat" );
			bs.debug = false;
			bs.run();
			
			MTFCompress mtf( "blocksortcompress.dat", blocksize );
			mtf.setOutputFilename( "mtfcompress.dat" );
			mtf.run();
			
			ModeloEstructuradoCompress modest( "mtfcompress.dat", blocksize );
			modest.setOutputFilename( "comprimido.txt.3" );
			modest.debug = false;
			modest.run();
		}
		
		if (*modoEjecucion == 'x') {
			
			ModeloEstructuradoDecompress modest( filename, blocksize );
			modest.setOutputFilename( "modestDecompressed.dat" );
			modest.debug = false;
			modest.run();
			
			MTFDecompress mtf( "modestDecompressed.dat" );
			mtf.setOutputFilename( "mtfDecompressed.dat" );
			mtf.run();
		
			BlocksortDecompress bs( "mtfDecompressed.dat" );
			bs.setOutputFilename("descomprimido.txt");
			bs.debug = false;
			bs.run();
		}
	}
	
	
	return 0;
}


